package com.jiarong.service.impl;

import com.jiarong.repository.AccountDao;
import com.jiarong.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 加绒
 * @date 2021/10/20 16:32
 */
@Service("accountService")
public class AccountServiceImpl implements AccountService {
    @Autowired
    private AccountDao accountDao;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void transfer(String payer, String payee, Double money) {
        accountDao.expenditure(payer, money);
//        int i = 1 / 0;
        accountDao.income(payee, money);
    }
}
